package com.wanmait.jd.controller;

import com.wanmait.jd.dao.UserinfoDAO;
import com.wanmait.jd.vo.Userinfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
public class LoginController {
    @RequestMapping("login")
    public String login(Userinfo userinfo){
        System.out.println(userinfo.getUsername()+":"+userinfo.getPassword());
        UserinfoDAO userinfoDAO = new UserinfoDAO();
        Userinfo loginUser = userinfoDAO.findByNameAndPass(userinfo);

        if (loginUser != null){
            return "redirect:/L/enter.jsp";
        }else {
            return "redirect:/L/login.jsp";
        }
    }
}
